﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using Microsoft.Phone.Controls;

namespace CapstoneMockup
{
    public partial class LocationComparisonPage : PhoneApplicationPage
    {
        public LocationComparisonPage()
        {
            InitializeComponent();
            this.Loaded += Page_Loaded;
        }

        private void Page_Loaded(object sender, RoutedEventArgs e)
        {
            if (!App.ViewModel.IsDataLoaded)
            {
                App.ViewModel.LoadData();
            }

            if (!double.IsNaN(App.GpsModel.TheirLocation.Latitude) || !double.IsNaN(App.GpsModel.TheirLocation.Longitude))
            {
                LocationComparerMap.Visibility = Visibility.Collapsed;
            }
            else
            {
                MyLocation.Location = App.GpsModel.CurrentLocation;
                TheirLocation.Location = App.GpsModel.TheirLocation;
                LocationNotGiven.Visibility = Visibility.Collapsed;
            }
        }
    }
}